﻿<Window x:Class="music_control.Options"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
        Title="music control options" Height="500" Width="400" Closing="Window_Closing" Icon="pack://application:,,,/Icons/musiccontrol.png" >
    <Window.Resources>

        <Style TargetType="{x:Type GroupBox}">
            <Setter Property="Padding" Value="10"/>
            <Setter Property="Margin" Value="10"/>
            <Setter Property="HeaderTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <TextBlock Text="{Binding}" Foreground="Black" FontWeight="Bold"/>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>

    </Window.Resources>
    <StackPanel>

        <GroupBox Header="General">

            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="16"/>
                </Grid.ColumnDefinitions>

                <CheckBox Grid.Column="0" Content="Autostart" IsChecked="{Binding autostart}"/>

                <Image Grid.Column="1" Height="16" Width="16" Source="/music-control;component/Icons/information.png" ToolTipService.ShowDuration="10000" >
                    <Image.ToolTip>
                        <ToolTip>
                            <StackPanel>
                                <TextBlock FontWeight="Bold">Autostart</TextBlock>
                                <TextBlock>If checked the server start automatically with the operating system.</TextBlock>
                            </StackPanel>
                        </ToolTip>
                    </Image.ToolTip>
                </Image>

            </Grid>
        </GroupBox>

        <GroupBox Header="Key configuration">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="16"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>

                <TextBlock Margin="5" Grid.Row="0" Grid.Column="0" Text="Play/pause" />
                <TextBlock Margin="5" Grid.Row="1" Grid.Column="0" Text="Next" />
                <TextBlock Margin="5" Grid.Row="2" Grid.Column="0" Text="Previous" />
                <TextBlock Margin="5" Grid.Row="3" Grid.Column="0" Text="Keycode" />

                <extToolkit:IntegerUpDown Margin="5" Minimum="0" Grid.Row="0" Grid.Column="1" Value="{Binding Controller.Keyobserver.startstop}" Width="70" HorizontalAlignment="Left" />
                <extToolkit:IntegerUpDown Margin="5" Minimum="0" Grid.Row="1" Grid.Column="1" Value="{Binding Controller.Keyobserver.next}"  Width="70"  HorizontalAlignment="Left" />
                <extToolkit:IntegerUpDown Margin="5" Minimum="0" Grid.Row="2" Grid.Column="1" Value="{Binding Controller.Keyobserver.previous}"  Width="70" HorizontalAlignment="Left" />
                <TextBox Margin="5" Grid.Row="3" Grid.Column="1" Text="{Binding Controller.Keyobserver.lastpressed}"  Width="70" HorizontalAlignment="Left" IsEnabled="False" HorizontalContentAlignment="Center" />


                <Image Grid.Column="2" Grid.Row="0" Height="16" Width="16" Source="/music-control;component/Icons/information.png" ToolTipService.ShowDuration="10000">
                    <Image.ToolTip>
                        <ToolTip>
                            <StackPanel>
                                <TextBlock FontWeight="Bold">Play</TextBlock>
                                <TextBlock>With this keycode the player start or stop the song.</TextBlock>
                                <TextBlock FontWeight="Bold">How do you know the keycode?</TextBlock>
                                <TextBlock>Press any key and look to the Keycode field.</TextBlock>
                            </StackPanel>
                        </ToolTip>
                    </Image.ToolTip>
                </Image>

                <Image Grid.Column="2" Grid.Row="1" Height="16" Width="16" Source="/music-control;component/Icons/information.png" ToolTipService.ShowDuration="10000">
                    <Image.ToolTip>
                        <ToolTip>
                            <StackPanel>
                                <TextBlock FontWeight="Bold">Next</TextBlock>
                                <TextBlock>With this keycode the player play the next the song.</TextBlock>
                                <TextBlock FontWeight="Bold">How do you know the keycode?</TextBlock>
                                <TextBlock>Press any key and look to the Keycode field.</TextBlock>
                            </StackPanel>
                        </ToolTip>
                    </Image.ToolTip>
                </Image>

                <Image Grid.Column="2" Grid.Row="2" Height="16" Width="16" Source="/music-control;component/Icons/information.png" ToolTipService.ShowDuration="10000">
                    <Image.ToolTip>
                        <ToolTip>
                            <StackPanel>
                                <TextBlock FontWeight="Bold">Previous</TextBlock>
                                <TextBlock>With this keycode the player play the previous the song.</TextBlock>
                                <TextBlock FontWeight="Bold">How do you know the keycode?</TextBlock>
                                <TextBlock>Press any key and look to the Keycode field.</TextBlock>
                            </StackPanel>
                        </ToolTip>
                    </Image.ToolTip>
                </Image>

                <Image Grid.Column="2" Grid.Row="3" Height="16" Width="16" Source="/music-control;component/Icons/information.png" ToolTipService.ShowDuration="10000">
                    <Image.ToolTip>
                        <ToolTip>
                            <StackPanel>
                                <TextBlock FontWeight="Bold">Keycode</TextBlock>
                                <TextBlock>Press any key and it shows the keycode of your keyboard key.</TextBlock>
                            </StackPanel>
                        </ToolTip>
                    </Image.ToolTip>
                </Image>

            </Grid>
        </GroupBox>

        <ItemsControl ItemsSource="{Binding Controller.Options}">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <UserControl Content="{Binding}"/>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>

        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>


            <Button Grid.Column="0" Margin="10" Content="Reset to default" Command="{Binding resetOptionCommand}"/>
            
            <Button Grid.Column="1" Margin="10" Content="Save" Command="{Binding SaveOptionCommand}"/>
            
        </Grid>



    </StackPanel>
</Window>
